package com.dadao.learn;

import com.dadao.learn.dao.UserDao;
import com.dadao.learn.pojo.User;
import org.apache.ibatis.session.SqlSession;

public class MybatisTest {
    public static void main(String[] args) {
        //获得会话
        SqlSession session = MybatisUtil.getSession();
        //构建映射接口 的动态对象
        UserDao userDao = session.getMapper(UserDao.class);
//        Student student = new Student();
//        student.setStudentName("张三1");
        User u = userDao.getUser("1");
        System.out.println(u.getName());
        //提交事务
        session.commit();
        MybatisUtil.close();
    }
}
